<?php
define ( 'FOOTPRINT_ROOT', realpath ( dirname ( __FILE__ ) . '/' ) );
define ( 'WP_ROOT', FOOTPRINT_ROOT . '/../../../' );

require_once (WP_ROOT . 'wp-blog-header.php');

$id = $_REQUEST ['id'];
$table_name = $wpdb->prefix . "footprint";

if (isset ( $id ) ) {
	$sql ="select * from `{$table_name}` where id=$id";
	$result = $wpdb->get_row ( $sql, OBJECT  );
	echo json_encode ( $result );
	exit ();
}

$result = $wpdb->get_results ( "select id, lat, lng from `{$table_name}`" );
echo json_encode ( $result );
?>
